package com.smasher.widget.stepper;

/**
 * 枚举
 */
public enum SnapMode {

    AUTO(0), CUSTOM(1);
    private final int value;

    SnapMode(int value) {
        this.value = value;
    }

    public int getValue() {
        return value;
    }

    public static SnapMode valueOf(int value) {    //    手写的从int到enum的转换函数
        return switch (value) {
            case 0 -> AUTO;
            case 1 -> CUSTOM;
            default -> AUTO;
        };
    }
}
